package org.linuxgears.BouncingBall;

import java.awt.Point;
import java.awt.geom.Point2D;

public class BallTools {
    public static double distance(Point a, Point b) {
    	return Point2D.distance(a.x, a.y, b.x, b.y);
    };    	
    
    public static double distanceSq(Point a, Point b) {
    	return Point2D.distanceSq(a.x, a.y, b.x, b.y);
    };    	
    
    public static Point getBallCenterByPosition(Ball ball, Point position) {
    	int radius = ball.getSize() / 2;
    	
    	return new Point(position.x + radius, position.y + radius);
    }

	public static Point getBallPositionByCenter(Ball ball, Point position) {
		int radius = ball.getSize() / 2;
		// TODO Auto-generated method stub
		return new Point(position.x - radius, position.y - radius);
	}
}